import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    redirect:'login',
  },
  {
    path: '/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "longin" */ '../views/login')
  },
  {
    path: '/regist',
    name: 'regist',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "regist" */ '../views/regist')
  },
  {
    path: '/regist_comp',
    name: 'regist_comp',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "regist_comp" */ '../views/regist_comp')
  },
  {
    path: '/layout',
    name: 'layout',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "layout" */ '../views/layout'),
    redirect: '/home',//页面默认加载的路由
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("../views/home")
      },
      {
        path: "/admin",
        name: "admin",
        component: () => import("../views/admin")
      },
      {
        path: "/hr",
        name: "hr",
        component: () => import("../views/hr")
      },
      {
        path: "/comp",
        name: "comp",
        component: () => import("../views/comp")
      },
      {
        path: "/news",
        name: "news",
        component: () => import("../views/news")
      },
      {
        path: "/news_detail",
        name: "news_detail",
        component: () => import("../views/news_detail")
      },
      {
        path: "/job",
        name: "job",
        component: () => import("../views/job")
      },
      {
        path: "/job_detail",
        name: "job_detail",
        component: () => import("../views/job_detail")
      },
      {
        path: "/upload",
        name: "upload",
        component: () => import("../components/upload")
      },
      {
        path: "/my",
        name: "my",
        component: () => import("../views/my")
      },
      {
        path: "/pwd",
        name: "pwd",
        component: () => import("../views/updata-pwd")
      },
      {
        path: "/comp_detail",
        name: "comp_detail",
        component: () => import("../views/comp_detail")
      },
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
